/*
 * @Description: 档案盒规格相关接口
 * @Author: Zzt
 * @Date: 2022-10-31 10:32:49
 * @LastEditTime: 2022-10-31 14:16:50
 */
import { IPageQuery } from '@/interfaces/global';
import request from '@/utils/request';
import { Key } from 'react';

interface IBoxNorms {
  code?: string;
  fileMaxPageCount?: string;
  name?: string;
  remark?: string;
  spineWith?: string;
  spineWithUnit?: string;
}
// 新增档案盒规格
export function addBoxNorms(data: IBoxNorms) {
  return request({
    url: `/archive-box-spec/`,
    method: 'post',
    data
  });
}

// 删除选中的档案盒规则
export function delBoxNorms(id: Key) {
  return request({
    url: `/archive-box-spec/${id}`,
    method: 'delete'
  });
}

interface IeditBoxNorms extends IBoxNorms {
  id: number;
}
// 修改档案盒规则
export function editBoxNorms(data: IeditBoxNorms) {
  return request({
    url: `/archive-box-spec/`,
    method: 'put',
    data
  });
}

export interface IBoxSpecParams {
  code?: string;
  createTime?: string;
  fileMaxPageCount?: string;
  id?: number;
  name?: string;
  operator?: number;
  operatorName?: string;
  operatorTime?: string;
  remark?: string;
  spineWith?: string;
  spineWithUnit?: string;
}

// 分页查询档案盒规格
export function fetchBoxNormsListByPage(data: IPageQuery<IBoxSpecParams>) {
  return request({
    url: `/archive-box-spec/page/`,
    method: 'post',
    data
  });
}

// 查询档案盒规格
export function fetchBoxSpecList(data: IBoxSpecParams) {
  return request({
    url: `/archive-box-spec/list`,
    method: 'post',
    data
  });
}
